//
//  MJ_ProjectDetailController.m
//  UEAssistant
//
//  Created by mac on 2018/1/10.
//  Copyright © 2018年 youyixinxi. All rights reserved.
//

#import "MJ_ProjectDetailController.h"
#import "MJ_ProjectDetailLayout.h"
#import "MJ_ProjectDetailCell.h"
@interface MJ_ProjectDetailController ()<UITableViewDelegate,UITableViewDataSource>

@property (strong, nonatomic)UITableView *tableView;

@end

@implementation MJ_ProjectDetailController

- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, Screen_Height-64) style:UITableViewStylePlain];
        [_tableView registerClass:[MJ_ProjectDetailCell class] forCellReuseIdentifier:@"MJ_ProjectDetailCell"];
        _tableView.tableFooterView = [UIView new];
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.dataSource = self;
        _tableView.delegate = self;
    }
    return _tableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = _model.project_name;
    [self.view addSubview:self.tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    MJ_ProjectDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MJ_ProjectDetailCell" forIndexPath:indexPath];
    cell.layout = [[MJ_ProjectDetailLayout alloc] initWithModel:_model index:indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    MJ_ProjectDetailLayout *layout =  [[MJ_ProjectDetailLayout alloc] initWithModel:_model index:indexPath.row];
    return layout.cellHeight;
}

@end
